<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<meta name="description" content="Mailbox with some customizations as described in docs" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<%@ include file="/include/person_include.jsp"%>
 <link type='text/css' rel='stylesheet' href='${path}/static/myjs/person/css/mui.min.css' /> 
 <link rel="stylesheet" href="${path}/static/myjs/person/css/base.css"/>
    <link rel="stylesheet" href="${path}/static/myjs/person/css/common.css"/>
    <link rel="stylesheet" href="${path}/static/myjs/person/css/page.css"/>
    <script src="${path}/static/myjs/person/js/jquery-1.9.1.min.js"></script>
    <script src="${path}/static/myjs/person/js/mobiscroll_002.js" type="text/javascript"></script>
    <script src="${path}/static/myjs/person/js/mobiscroll_004.js" type="text/javascript"></script>
    <link href="${path}/static/myjs/person/css/mobiscroll_002.css" rel="stylesheet" type="text/css">
    <link href="${path}/static/myjs/person/css/mobiscroll.css" rel="stylesheet" type="text/css">
    <script src="${path}/static/myjs/person/js/mobiscroll.js" type="text/javascript"></script>
    <script src="${path}/static/myjs/person/js/mobiscroll_003.js" type="text/javascript"></script>
    <script src="${path}/static/myjs/person/js/mobiscroll_005.js" type="text/javascript"></script>
    <link href="${path}/static/myjs/person/css/mobiscroll_003.css" rel="stylesheet" type="text/css">
    <script src="${path}/static/myjs/person//js/jqbar.js" type="text/javascript"></script>

    </head>
<body>
<div class="main fr">
    <div class="bar"></div>
    <p class="tishi bdb1">
    <span class="h2-bar"></span>经营统计</p>
    <div class="count-main">
    	<form action="${path }/home/tohome"  method="post" id="dataform">
        <div class="content">
            <div class="demos">
                <!--<label for="startTime">开始日期</label>-->
                开始日期：
                <input   value="${startTime }"  readonly name="startTime"  id="startTime" type="text">
            </div>
            <div class="demos">
                <!--<label for="endTime">结束日期</label>-->
                结束日期：
                <input value="${endTime }" class="" readonly name="endTime" id="endTime" type="text">
            </div>
            <div class="demos">
                <button type="button" class="button_foot_yellow" id="subbutton">统计</button>
                <c:if test="${role.roleCode.equals('agent') }">
                <button type="button" class="button_foot_yellow" id="subbuttonWithdraw">提现</button>
                </c:if>
            </div>

        </div>
        </form>
        <div id="main">
            <div class="apart">
                <div id="today">
                    <div class="icon">
                        <i class="iconfont icon-money"></i>
                    </div>
                    <div class="apart-left">
                        <p>总订单数量</p>
                        <b>￥</b>
                        <a href="#" id="myBusinessTodayRebate">
                            <i>${pd.orderCount }</i>
                        </a>
                    </div>
                </div>
                <div id="waiting">
                    <div class="icon">
                        <i class="iconfont icon-dengdai1"></i>
                    </div>
                    <div class="apart-left">
                        <p>总订单金额</p>
                        <b></b>
                        <a href="#" id="myBusinessRebate">
                            <i>${empty pd.orderAmount?0:pd.orderAmount }</i>
                        </a>
                    </div>
                </div>
                <div id="commercial">
                    <div class="icon">
                        <i class="iconfont icon-Shape"></i>
                    </div>
                    <div class="apart-left">
                        <p>微信支付金额</p>
                        <a href="" id="myBusiness">
                            <i>${ empty pd.wxOrderAmount?0:pd.wxOrderAmount  }</i>
                        </a>
                        <p>微信服务费金额</p>
                        <a href="" id="myBusiness">
                            <i>${ empty pd.wxServiceAmount?0:pd.wxServiceAmount  }</i>
                        </a>
                    </div>
                </div>
                <div id="try">
                    <div class="icon">
                        <i class="iconfont icon-shiyong"></i>
                    </div>
                    <div class="apart-left">
                        <p>支付宝支付金额</p>
                        <a href="#" id="myBusinessOntria">
                            <i>${ empty pd.aliOrderAmount?0:pd.aliOrderAmount  }</i>
                        </a>
                        <p>支付宝服务费</p>
                        <a href="#" id="myBusinessOntria">
                            <i>${ empty pd.aliServiceAmount?0:pd.aliServiceAmount  }</i>
                        </a>
                    </div>
                </div>
            </div>
        </div>
        
    </div>
</div>
    <script type="text/javascript">
            $(function () {
                var currYear = (new Date()).getFullYear();
                var opt={};
                opt.date = {preset : 'date'};
                opt.datetime = {preset : 'datetime'};
                opt.time = {preset : 'time'};
                opt.default = {
                    theme: 'android-ics light', //皮肤样式
                    display: 'modal', //显示方式
                    mode: 'scroller', //日期选择模式
                    dateFormat: 'yyyy-mm-dd',
                    lang: 'zh',
                    showNow: true,
                    nowText: "今天",
                    startYear: currYear - 70, //开始年份
                    endYear: currYear + 0 //结束年份
                };

                $("#startTime").mobiscroll($.extend(opt['date'], opt['default']));
                $("#endTime").mobiscroll($.extend(opt['date'], opt['default']));
                var optDateTime = $.extend(opt['datetime'], opt['default']);
                var optTime = $.extend(opt['time'], opt['default']);
                $("#startTimeTime").mobiscroll(optDateTime).datetime(optDateTime);
                $("#appTime").mobiscroll(optTime).time(optTime);
            });
 

    $("#subbuttonWithdraw").on("click",function check(){
    	$.get(  '${path}/hhWithdrawAgent/agentWithdraw.do', function(data, status) {
            if (data.code==0) {
                    layer.msg('已提现');
            } 
        });
    });
    $("#subbutton").on("click",function check(){

        var starttime = $('#startTime').val();
        var endtime = $('#endTime').val();

        var sdate = $("#startTime").val();
        var edate = $("#endTime").val();
        if(sdate == ''){
            alert("起始时间不能为空");
            return false;
        }
        if(edate == ''){
            alert("结束时间不能为空");
            return false;
        }

        
        var start = new Date(starttime.replace("-", "/").replace("-", "/"));
        var end = new Date(endtime.replace("-", "/").replace("-", "/"));

        if (end < start) {
            alert('结束日期不能小于开始日期！');
            return false;
        }else {
        	$("#dataform").submit();
        }
    });

    </script>
</body>
</html>